{{extend './extend.art'}}
{{block 'title'}}
文章详情
{{/block}}
{{block 'css'}}
<link rel = "stylesheet" href = "/home/css/article.css">
{{/block}}
{{block 'body'}}
<body>
    {{include './header.art'}}
    <!-- 文章框架开始 -->
    <div class = "article">
        <div class = "w1100">
            <div class = "container">
                <div class = "article-header">
                    <h3 class = "article-title">{{result.title}}</h3>
                    <div class = "article-info">
                        <span class = "author">{{result.writer.name}}</span>
                        <span>{{dateFormat(result.time,'yyyy-mm-dd')}}</span>
                    </div>
                </div>
                <div class = "article-content">
                    {{@result.content}}
                </div>
                <div class = "article-comment">
                    {{if userInfo!==undefined}}
                    <h4>评论</h4>
                    <form class = "comment-form" method = "post" action = "/home/comment">
                        <textarea class = "comment" name = "content"></textarea>
                        <input type = "hidden" name = "uid" value = "{{@userInfo._id}}">
                        <input type = "hidden" name = "aid" value = "{{@result._id}}">
                        <div class = "items">
                            <input type = "submit" value = "提交">
                        </div>
                    </form>
                    {{else }}
                    <h2>请先进行登录，再对文章进行评论</h2>
                    {{/if}}
                    <div class = "comment-list">
                        {{each comment}}
                        <div class = "mb10">
                            <div class = "article-info">
                                <span class = "author">{{$value.uid.name}}</span>
                                <span>{{dateFormat($value.time,'yyyy-mm-dd')}}</span>
                                <span>{{$value.uid.email}}</span>
                            </div>
                            <div class = "comment-content">
                                {{$value.content}}
                            </div>
                        </div>
                        {{/each}}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 文章框架结束 -->
</body>
{{/block}}